package com.zy.mc_module.wheel.recyclerview.divider;

import android.content.Context;
import android.graphics.Rect;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import com.zy.mc_module.utils.SizeUtils;

/**
 * Created on 2019/03/17
 * 商品列表 瀑布流设置间隔
 */
public class TopItemDivider extends RecyclerView.ItemDecoration {
    private Context context;

    public TopItemDivider(Context context) {
        this.context = context;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        // 获取item在span中的下标
        int position = parent.getChildLayoutPosition(view);
        if (position == 0) {
            outRect.top = SizeUtils.dp2px(context, 10f);
        }
    }
}
